﻿using Grow.Module.Service;

namespace Grow.Scheduler.Job
{
    public abstract class JobBase : IJob
    {
        protected readonly IServiceContext _serviceContext;

        public JobBase(IServiceContext serviceContext)
        {
            _serviceContext = serviceContext;
        }

        public abstract Task ExecuteAsync(CancellationToken cancellationToken);
    }

    public abstract class JobBase<TJobData> : IJob<TJobData>
    {
        protected readonly IServiceContext _serviceContext;

        public JobBase(IServiceContext serviceContext)
        {
            _serviceContext = serviceContext;
        }

        public abstract Task ExecuteAsync(TJobData jobData, CancellationToken cancellationToken);
    }
}